import * as types from './mutation-types'

export const toggleSidebars = ({ commit }, hidden) => commit(types.TOGGLE_SIDEBARS, hidden)

export const toggleSidebarls = ({ commit }, hidden) => commit(types.TOGGLE_SIDEBARLS, hidden)

export const toggleSidebar = ({ commit }, opened) => commit(types.TOGGLE_SIDEBAR, opened)

export const toggleSidebarl = ({ commit }, opened) => commit(types.TOGGLE_SIDEBARL, opened)

export const setModal = ({ commit }, data) => commit(types.SET_MODAL, data)

export const toggleDevice = ({ commit }, device) => commit(types.TOGGLE_DEVICE, device)

export const toggleTpl = ({ commit }, type) => commit(types.TOGGLE_TPL, type)

export const setPage = ({ commit }, page) => commit(types.SET_PAGE, page)

export const setStatus = ({ commit }, b) => commit(types.SET_STATUS, b)

export const expandMenu = ({ commit }, menuItem) => {
  if (menuItem) {
    menuItem.expanded = menuItem.expanded || false
    commit(types.EXPAND_MENU, menuItem)
  }
}

export const switchEffect = ({ commit }, effectItem) => {
  if (effectItem) {
    commit(types.SWITCH_EFFECT, effectItem)
  }
}
